<template>
  <div>
    <zbTable :api-fun="get_list">
      <template #toolbar>
        <a-space>
          <a-button class="btn"><span>导出</span></a-button>
          <a-button class="btn" @click="init()"
            ><span>库存初始化</span></a-button
          >
        </a-space>
      </template>
      <!-- <template v-slot:optBtn="{ record }">
				<a @click="toDetail(record)">查看</a>
			</template> -->
    </zbTable>
  </div>
</template>

<script setup>
  import { Modal } from 'ant-design-vue';
  import { useRouter } from 'vue-router';
  import zbTable from '@/components/zbTable/index.vue';
  import { get_list } from '@/api/jewelry/goods_info';

  const { push } = useRouter();

  const init = () => {
    Modal.confirm({
      title: '重要提示',
      content:
        '使用库存初始化清零，将影响跟库存有关的数据，及单据，只有销售单据不会影响，请谨慎操作！',
      okText: '确认',
      cancelText: '取消',
      onOk() {
        console.log('11');
      },
      onCancel() {
        console.log(22);
      }
    });
  };
  const toDetail = (record) => {
    push({
      path: '/jewelry/goods_info/detail',
      query: { code: record.code }
    });
  };
</script>
